using System.Collections.Generic;
using System.IO;

namespace FileDirUtils
{
    public class FileFilterExtension : IFilter
    {
        readonly List<string> extensions = new List<string>();
        public FileFilterExtension(string extensionsString)
        {
            char[] delims = ",;|".ToCharArray();          
            foreach (string ext in extensionsString.Split(delims))
            {
                string s = "." + ext.ToUpper();
                extensions.Add(s);                
            }
        }
        public bool Match(string fullFileName)
        {
            string ext = Path.GetExtension(fullFileName).ToUpper();
            return extensions.Contains(ext);            
        }
    }
}